package demo;

import java.util.Scanner;

/**
 * @Auther: hjy(lc))
 * @Date: 2022/7/16-07-16-10:28
 * @Description：枚举
 */
public class EnumTest {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        System.out.print("请输入一个尺码：(SMALL,MEDIUM,LARGE,EXTRA_LARGE)");
        //忽略大小写
        String input = in.next().toUpperCase();
        Size size = Enum.valueOf(Size.class,input);
        System.out.println("size = "+size);
        System.out.println("abbreviation = " + size.getAbbreviation());
        if(size == Size.EXTRA_LAGRE){
            System.out.println("Good job--you paid attention to the _.");
        }
    }
}
enum Size{
    SMALL("S"),MEDIUM("M"),LARGE("L"),EXTRA_LAGRE("XL");
    private Size(String abbreviation){
        this.abbreviation = abbreviation;
    }
    public String getAbbreviation(){
        return abbreviation;
    }
    private  String abbreviation;
}
